package main

import (
	"context"
	"fmt"
	"time"
)

func main() {
	// var s struct{}
	// e := struct{}{}
	// fmt.Println(s)
	// fmt.Println(e)
	// fmt.Println(unsafe.Sizeof(s)) // prints 0
	// fmt.Println(unsafe.Sizeof(e)) // prints 0

	ch := make(chan struct{})

	ctx, _ := context.WithTimeout(context.Background(), time.Second*3)

	time.Sleep(time.Second)

	go func() {
		fmt.Println("test,,,,,,,,")
		time.Sleep(time.Second * 5)
		ch <- struct{}{}
	}()

	select {
	case x := <-ch:
		fmt.Println(x)
		return
	case <-ctx.Done():
		fmt.Println("链接超时，，，，，，，，")
	}

	ctx.Done()

}
